#动态库生成
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)

libmyc.so:$(OBJ)
	@gcc -shared -o $@ $^
	@echo "build $^ to $@ done"
%.o:%.c
	@gcc -fPIC -c $<
	@echo "编译 $< 成 $@"

.PHONY:output
output:
	@mkdir -p ./lib/include
	@mkdir -p ./lib/mylib
	@cp -f *.h lib/include
	@cp -f *.so lib/mylib
	@tar -czf lib.tgz lib
	@echo "out put libmyc ...  done"
.PHONY:clean
clean:
	@rm -rf *.so *.o lib*
	@echo "clean ... done"


#静态库生成
#SRC=$(wildcard *.c)
#OBJ=$(SRC:.c=.o)
#
#libmyc.a:$(OBJ)
#	@ar -rc $@ $^
#	@echo "build $^ to $@ done"
#%.o:%.c
#	@gcc -c $<
#	@echo "编译 $< 成 $@"
#
#.PHONY:output
#output:
#	@mkdir -p ./lib/include
#	@mkdir -p ./lib/mylib
#	@cp -f *.h lib/include
#	@cp -f *.a lib/mylib
#	@tar -czf lib.tgz lib
#	@echo "out put libmyc ...  done"
#.PHONY:clean
#clean:
#	@rm -rf *.a *.o lib*
#	@echo "clean ... done"
